package cn.edu.ujn.dongz023.info.project.service;

import java.util.List;

import cn.edu.ujn.dongz023.info.project.dao.ProjectMapper;
import cn.edu.ujn.dongz023.info.project.entity.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProjectServiceImpl implements IProjectService {

    @Autowired
    private ProjectMapper projectMapper;

    @Override
    public Project findById(int id) {
        return projectMapper.selectByPrimaryKey(id);
    }

    @Override
    public Project add(Project project) {
        int insert = projectMapper.insert(project);
        return project;
    }

    @Override
    public List<Project> findAll() {
        return projectMapper.findAll();
    }

    @Override
    public Project update(Project project) {
        projectMapper.updateByPrimaryKeySelective(project);
        return project;
    }

    @Override
    public void delete(Integer id) {
        projectMapper.deleteByPrimaryKey(id);
    }
}
